﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using QLabValues;
using Engine;
using ParserCore;
using AtomicTypes;

namespace TestEngine
{
    [TestClass]
    public class UnitTest
    {
        [TestMethod]
        public void ConstantTest()
        {
            var command = "x=5.14; y=4.12; z=-15;";
            Dictionary<string, string> currentFolder = new Dictionary<string, string>();
            List<Dictionary<string, string>> pathFolder = new List<Dictionary<string, string>>();

            EngineManager.Instance.Execute(command, currentFolder, pathFolder);

            var x = EngineManager.Instance.engineVisitor.VariableTable.LookUp(new Identifier("x"));
            var y = EngineManager.Instance.engineVisitor.VariableTable.LookUp(new Identifier("y"));
            var z = EngineManager.Instance.engineVisitor.VariableTable.LookUp(new Identifier("z"));

            var x1 = new QFloat64NDimArray(new QFloat64[]{ new QFloat64(5.14) }, new int[]{ 1, 1 });
            var y1 = new QFloat64NDimArray(new QFloat64[]{ new QFloat64(4.12) }, new int[]{ 1, 1 });
            var z1 = new QFloat64NDimArray(new QFloat64[]{ new QFloat64(-15) }, new int[]{ 1, 1});

            Assert.AreEqual(x, x1);
            Assert.AreEqual(y, y1);
            Assert.AreEqual(z, z1);

        }
    }
}
